<template>
    <div class="cbox">
        <h3>子组件</h3>
        <div>
            接收信息:{{ message }}--->{{ price }}
        </div>
        <div>
            子到父:<button @click="send">发送</button>
        </div>
    </div>
</template>

<script lang='ts' setup>
    //import IEmitType from '@/types/IEmitType'
    import {defineProps,defineEmits} from 'vue'
    // defineProps(['message','price'])
    defineProps<{message:string,price:number}>()
    //执行defineEmits
    const emit=defineEmits<{(e:'make',value:string):void}>()
    //定义send方法
    const send=()=>{
        //从子到父发送信息,参数1为自定义事件名称，参数2为所要传递的数据
        emit('make','白日依山尽，黄河入海流')
    }
</script>

<style lang='scss' scoped>
.cbox{
    width: 300px;
    height: 300px;
    background-color: springgreen;
}
</style>